<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateResourcesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('resources', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->string('name',40);
            $table->char('phone',15);
            $table->char('phone2',15);
            $table->integer('qq');
            $table->string('wechat',45);
            $table->integer('budget');                    //预算
            $table->integer('process_id')->index();       //进程id
            $table->integer('res_type_tid')->index();     //类型id
            $table->integer('res_resource_rid')->index(); //来源id
            $table->integer('users_id')->index();         //录入人id
            $table->integer('yyzg_id')->index();          //邀约主管id
            $table->integer('yyzg_time');                 //录入时间
            $table->integer('yyyg_id')->index();          //邀约员工
            $table->integer('yyyg_time');                 //邀约操作时间
            $table->integer('invite_status')->default(0); //邀约状态
            $table->integer('schedule')->index()->default(0);       //进店时间
            $table->integer('mszg_id')->index();          //门市主管
            $table->integer('mszg_time');
            $table->integer('msyg_id')->index();          //门市员工
            $table->integer('msyg_time');                 //接待时间
            $table->integer('reception_status')->default(0); //接待状态
            $table->string('rdes');                       //资源备注

            $table->string('order_code')->default('');      //订单号码

            $table->integer('yy_time_again');               //邀约再约时间
            $table->integer('ms_time_again');               //门市再约时间

            $table->integer('yy_process_id')->index();       //邀约进程id
            $table->integer('ms_process_id')->index();      //门市进程id
            $table->integer('deal_price');                  //成交价格
            $table->integer('created');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('resources');
    }
}
